<?php namespace Admin\Controller;

use Common\Model\Gorder;

class OrderController extends CommonController{
	private $db;
		
	
	public function __init(){
		
		$this->db=new Gorder;
		
		parent::__init();
		
	}
	
	public function index(){
		
		$data=$this->db->get();
		
		View::with('data',$data);
		
		View::make();
	}
	
	public function un_order(){
		
		$data=$this->db->where('status','待发货')->get();
		
		View::with('data',$data);
		
		View::make();
	}	

	public function sendOrder(){
		$oid=Q('get.oid',0,'intval');
		
		$this->db->where('oid',$oid)->update(array('status'=>'已发货'));
		
		View::success('发货成功',U('index'));
	}
	
	public function del(){
		$oid=Q('get.oid',0,'intval');
		
		$this->db->where('oid',$oid)->delete();
		
		$orderlistModel=new \Common\Model\Gorderlist;
		
		$orderlistModel->where('order_oid',$oid)->delete();
		
		View::success('删除成功',U('index'));
	}
}
